package banking;

public class Account {
		  private double   balance;//定义一个私有属性
		  public Account(Double bal) {//定义一个公有方法来存储账户信息
		    balance =bal;
		  }
		  public double getBalance() {//定义一个公有方法来存储余额信息
		    return balance;
		  }
		  public boolean deposit(double amount) {//定义一个公有方法来存储钱数信息
		    balance = balance + amount;
		    return true;
		  }
		  public boolean withdraw(double amount) {//定义一个公有方法来存储金额改变信息
		    boolean result = true;
		    if ( balance < amount ) {//如果取出的金额大于余额
		      result = false;
		    } else {
		      balance = balance - amount;//反之则扣除相应金额
		    }
		    return result;
		  }
}


